fix: stabilize -Zrustdoc-depinfo#17020
Conversation
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Oops. This is not going to work without flagging every cargo doc test case nightly-only 🥲 |
c5f28e7 to
0cc616a
Compare
0cc616a to
94cc4e0
Compare
This comment has been minimized.
This comment has been minimized.
1180628 to
e143eee
Compare
This comment has been minimized.
This comment has been minimized.
76c6730 to
b76bf7e
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
|
@rfcbot fcp merge T-cargo |
|
@weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members: Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
b76bf7e to
063ce16
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
063ce16 to
7e7f37a
Compare
This comment has been minimized.
This comment has been minimized.
7e7f37a to
5c201d1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5c201d1 to
09a03c1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
09a03c1 to
bed8e31
Compare
This comment has been minimized.
This comment has been minimized.
With this stabilization, `cargo doc` unconditionally emits rustdoc depinfo via `rustdoc --emit=dep-info`. Before this, `cargo doc` used to track file changes via filesystem traversal. The depinfo files are emitted to Cargo's fingerprint which is a private location so we don't have to commit any stability around it if we want to move it somewhere else in future versions. Note that `rustdoc --output-format json` still use the old package fingerprint because `--output-format json` is not yet compatible and controllable through `--emit`.
bed8e31 to
5f1508c
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I found one regression case from this feature: Problem
Cargo places rustdoc's dep-info file under its private fingerprint directory. It then embeds that path into rustdoc's comma-separated Rustdoc splits the entire value on commas, causing the portion after the comma in the path to be interpreted as another emission type: A comma is valid in a target directory name, and the same cargo doc command succeeds when rustdoc dep-info is not enabled. Expected behavior (if you are using the current PR, there is no need to add the should succeed and generate: Actual behavior: it will fail with an Steps $ cargo new --lib --name comma_target cargo-rustdoc-depinfo-comma-repro
$ cd cargo-rustdoc-depinfo-comma-repro
$ cargo +nightly doc -Zrustdoc-depinfo --target-dir 'target,comma' -vv For comparison, this succeeds: $ cargo +nightly doc --target-dir 'target,comma' I think this is a very corner case, so I’m not sure if it’s really worth fixing. But it does look like a regression, although I guess not many people would put a comma in the path. So I’m not sure, @weihanglo, what do you think? And do we need to bother fixing this? |
|
@rfcbot concern comma-in-path |
|
Filed rust-lang/rust#159743 |
|
One workaround: fall back to the old file walk solution when comma is detected. |
View all comments
---> FCP <---
What does this PR try to resolve?
With this stabilization,
cargo docunconditionally emits rustdoc depinfovia
rustdoc --emit=dep-info.Before this,
cargo docused to track file changes via filesystem traversal just like build scripts, and it cannot detect these cases:lib.path = "../lib.rs"include_str!to include files outisde pakcage root, e.g.,#[doc = include_str!("../outside/pkgroot")]#[path = "../outside/pkgroot"]env!in doc attribute, e.g.,#[doc = env!("…")]The depinfo files are emitted to Cargo's fingerprint which is a private location so we don't have to commit any stability around it if we want to move it somewhere else in future versions.
Fixes #15370
How to test and review this PR?
While this is a bugfix, I assume we still need an FCP for it.